package com.cym.test.dao;

import com.cym.test.domain.User;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Repository;

@Repository("userDao")
public class UserDao {
//    @Autowired
//    private SqlSession sqlSession;
    public User findAll(Integer id){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        SqlSession sqlSession = (SqlSession) ac.getBean("sqlSession");
        return sqlSession.selectOne("com.cym.test.dao.UserDao.findAll",id);
    }
}
